<script>
    function post() {
        $.post('<?php echo base_url(); ?>reservation/savePaym/', {
            payment_id: $("#service").val(),
            total: $('#jumlah').autoNumeric('get'),
            desc:$('#desc').val(),
            code:$('#code').val(),
            resv_id: <?php echo $resv_id; ?>
        }, function() {
            window.location.replace(document.referrer);
        });
    }
	
	$(document).ready(function() {
		var rp = {aSep: '.',aDec: ',',vMin: '0.00',vMax: '999999999999.99'};
		$('.rp').autoNumeric('init',rp);
		
	});

</script>
<table class="table">
    <tr>
        <td>Choose Payment</td>
        <td>
            <select id="service">
                <?php
                foreach ($payment_type as $row) {
                    echo '<option value="' . $row['payment_id'] .'">' . $row['payment_name'] . '</option>';
                }
                ?>
			</select><span id="price"></span>
        </td>
    </tr>
	<tr>
		<td>Voucher/Card Code</td>
		<td><input id="code" maxlength="20" type="text"></td>
	</tr>
    <tr>
		<td>Balance</td>
		<td>Rp. <?= number_format($balance,2,',','.') ?></td>
	</tr>
    <tr>
        <td>Amount</td>
        <td>
			<div class="input-prepend">
				<span class="add-on">Rp</span>
				<input id="jumlah" class="rp" type="text">
			</div>
        </td>
    </tr>

    <tr>
        <td>Description</td>
        <td>
            <textarea id="desc" maxlength="50"></textarea>
        </td>
    </tr>
</table>
<a class="btn btn-primary" href="javascript:void(0)" onclick="javascript:post();">Save</a>
